 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;

 public class Cinema {
        //场次    日期String   影厅String    电影String
        private static HashMap<List<String>, List<String>> cinemaMap = new HashMap<>();
        private static HashMap<String, Integer> cinemaTicketSales = new HashMap<>();
        private static HashMap<String, Float> cinemaTicketPrice = new HashMap<>();
        private static HashMap<String, Float> cinemaTicketRfound = new HashMap<>();
        private static HashMap<String, List<Integer>> cinemaRoom = new HashMap<>();
        private static HashMap<List<String>, Boolean> cinemaSeat = new HashMap<>();
        private static HashMap<List<String>, String> cinemaID = new HashMap<>();

     public static HashMap<List<String>, String> getCinemaID(){
         return cinemaID;
     }

     public static void setCinemaID(String date,String room, String row, String col, String id){
         List<String> key = new ArrayList<>() ;
         key.add(date);
         key.add(room);
         key.add(row);
         key.add(col);
         cinemaID.put(key,id);
     }

        public static void setCinemaSeat(String date,String room, boolean seat,int totalRow, int totalCol){
            for(int i = 0;i < totalRow ;i++){
                for(int j = 0;j < totalCol;j++){
                    List<String> key = new ArrayList<>() ;
                    key.add(date);
                    key.add(room);
                    key.add(String.valueOf(i));
                    key.add(String.valueOf(j));
                    cinemaSeat.put(key,seat);
                }
            }
        }

     public static void chooseCinemaSeat(String date,String room, boolean seat,String row, String col){
            List<String> key = new ArrayList<>() ;
            key.add(date);
            key.add(room);
            key.add(String.valueOf(row));
            key.add(String.valueOf(col));
            cinemaSeat.put(key,seat);
     }

     public static void chooseCinemaSeat(List<String> key, boolean seat){
         cinemaSeat.put(key,seat);
     }

        public static boolean ifHaveCinemaSeat(String date,String room,int row, int col){
            List<String> key = new ArrayList<>() ;
            key.add(date);
            key.add(room);
            key.add(String.valueOf(row));
            key.add(String.valueOf(col));

            return cinemaSeat.get(key);
        }

     public static HashMap<List<String>, Boolean> getCinemaSeat(){
         return cinemaSeat;
     }


          public static void setCinemaRefund(String key1, float value1){
              if(cinemaTicketRfound.get(key1) != null) {
                  cinemaTicketRfound.put(key1, cinemaTicketRfound.get(key1) + value1);
              }else {
                  cinemaTicketRfound.put(key1, value1);
              }
        }


        public static float getTicketRefund(String key){
            if(cinemaTicketRfound.get(key) == null){
                return 0;
            }else {
                return cinemaTicketRfound.get(key);
            }
        }

        public static void setCinemaRoom(String name , int row, int col ){
              cinemaRoom.put(name,new ArrayList<>());
              cinemaRoom.get(name).add(row);
              cinemaRoom.get(name).add(col);

        }
        public static HashMap<String, List<Integer>> getCinemaRoom(){
              return cinemaRoom;
        }
        public static int getRow(String name){
              return cinemaRoom.get(name).get(0);
        }
        public static int getCol(String name){
              return cinemaRoom.get(name).get(1);
        }


        public static void setCinema(String key1,String key2, String value1){
            List<String> key = List.of(key1,key2);
            cinemaMap.put(key,new ArrayList<>());
            cinemaMap.get(key).add(value1);
        }

        public static void changeCinemaTime(String key, String key0, String key00, String value1){
            List<String> key1 = List.of(key,key00);
            List<String> key2 = List.of(key0,key00);
            cinemaMap.put(key2,new ArrayList<>());
            cinemaMap.get(key2).add(value1);
            cinemaMap.remove(key1);
        }
        public static void removeCinema(String key1){
            cinemaMap.remove(key1);
            cinemaTicketSales.remove(key1);
            cinemaTicketPrice.remove(key1);

        }
        public static void setCinemaPrice(String key1, float value1){
            cinemaTicketPrice.put(key1,value1);

        }
        public static void setCinemaSales(String key1, int value1){
         if(cinemaTicketSales.get(key1) != null) {
             cinemaTicketSales.put(key1, cinemaTicketSales.get(key1) + value1);
         }else {
             cinemaTicketSales.put(key1, value1);
         }
        }
        public static HashMap<List<String>, List<String>> getCinemaMap(){
            return cinemaMap;
        }
        public static float getTicketPrice(String key){
            if(cinemaTicketPrice.get(key) == null){
                return 0;
            }else {
                return cinemaTicketPrice.get(key);
            }
        }

        public static int getTicketSales(String key){
            if(cinemaTicketSales.get(key) == null){
                return 0;
            }else {
                return cinemaTicketSales.get(key);
            }
        }


}
